import axios from 'axios'
// 设置根路径
const service = axios.create({
  baseURL: 'http://127.0.0.1:3000'
})

// 请求拦截
service.interceptors.request.use(
  (config) => {
    return config
  },
  (err) => {
    Promise.reject(err)
  }
)

// 响应拦截
service.interceptors.response.use(
  (response) => {
    return response.data
  },
  (err) => {
    Promise.reject(err)
  }
)

// 暴露
export default service
